<template>
  <PCard :isCardBorder="false" :isHeadBottomBorder="false" :shadow="'never'" :bodyStyle="{ width: '100%' }">
    <div slot="header" class="card-title">
      <span class="title">{{ title }}</span>
      <!-- protocolType 1 总包（禁用）   2 分包（可用） -->
      <a-button
        v-if="config.setCorporateAccounts"
        :disabled="config.protocolType == 1 ? true : false"
        style="float: right"
        icon="setting"
        @click="pzqyzhEvent"
        >配置企业账户
      </a-button>
    </div>
    <!-- vertical   horizontal-->
    <a-steps class="steps-con" :current="current" :labelPlacement="'vertical'">
      <a-step :status="getNodeStatuInfo(item, index)" :key="'a-step-' + index" v-for="(item, index) in nodeList">
        <a-icon slot="icon" v-bind="getNodeStatuInfoIconAttr(item, index)" />
        <!-- display: flex;
    justify-content: center;
    align-items: center; -->
        <div
          class="title"
          :style="{
            color: getNodeStatuInfoIconAttr(item, index).twoToneColor,
            display: 'flex',
            'justify-content': 'center',
            'align-items': 'center',
            ...titleMarginStyle[item.setNodeType],
          }"
          slot="title"
        >
          <a-tooltip v-if="getHelp(item)" placement="right" overlayClassName="tooltip-con">
            <template slot="title">
              <a-button type="link" @click="helpEvent(item)">{{ getHelp(item).btnLabel }}</a-button>
              {{ getHelp(item).label }}
            </template>
            <div class="dddd">
              {{ item.setNodeName }}
              <!-- v-if="getUserNodeInfo(item)" :theme="getNodeStatuInfoIconAttr(item,index).theme" :twoToneColor="getNodeStatuInfoIconAttr(item,index).twoToneColor" -->
              <a-icon style="margin-left: 4px" type="question-circle" />
            </div>
          </a-tooltip>
          <template v-if="!getHelp(item)">
            {{ item.setNodeName }}
          </template>
          <!-- 表示需要用户操作的节点 -->
          <my-icon
            v-if="getUserNodeInfo(item)"
            :type="'icon-yonghuhuaxiang'"
            theme="twoTone"
            :twoToneColor="'#faad14'"
          />
        </div>
        <!-- 当 实名验证码 节点 的状态为 3 时，不显示此状态 stateMarginStyle-->
        <div class="subTitle" :style="{ color: getNodeStatuInfoIconAttr(item, index).twoToneColor, ...stateMarginStyle[item.setNodeType] }" slot="subTitle" v-if="!(item.setNodeType == 17 && item.setNodeStatus == 3)" :title="getState(item)" >
          {{ getState(item) }}
        </div>
        <div class="description" slot="description" :id="item.opDis">
          <!-- <div :style="btnStateStyle[item.opDis]" v-if="btnState[item.opDis] && (item.setNodeStatus === 0 || item.setNodeStatus === 2 || item.setNodeStatus === 3)" > -->
          <div :style="btnStateStyle[item.opDis]" v-if="btnState[item.opDis] " >
            <a-button :key="'btn-item-' + index" v-for="(btnItem, index) in btnState[item.opDis] || btnState['def']" type="primary"  @click="haveInEvent(item, btnItem)" style="margin: 3px 0" v-has="btnStateAuth[item.opDis][index]" >{{ btnItem }}</a-button>
          </div>
            <!-- <a-button :key="'btn-item-' + index" v-for="(btnItem, index) in btnState[item.opDis] || btnState['def']" type="primary"  @click="haveInEvent(item, btnItem)" style="margin: 3px 0" >{{ btnItem }} </a-button> -->

          <!-- {{getUserNodeInfo(item)}}11 -->
          <!-- <a-tooltip v-if="item.setNodeStatus === 3 && config.dataType === 1 && current >= index" placement="right" overlayClassName="tooltip-con">
            <template slot="title">
              <span v-if="config.dataType === 1">
                <a @click="getAction('1', item)">点击复制链接</a>，发送给客户填写，或<a @click="getAction('2', item)">点此补充</a>
              </span>
            </template>
            <a-button type="danger"> 补充或修改资料 </a-button>
          </a-tooltip> -->
          <!-- && config.data.realNameCodeTime -->
          <div
            v-if="item.setNodeType == 11 && config.data.realNameCodeTime"
            class="info"
            style="color: rgba(0, 0, 0, 0.45); margin: 5px 0"
          >
            预约时间： {{ config.data.realNameCodeTime }}
          </div>
          <!-- <div v-if="item.setNodeStatus !== 1&& config.dataType === 1 && current >= index" class="mesg" style="color: #ff4d4f;margin: 5px 0;">{{item.errMsg}}fgdgs</div> -->
          <div
            v-if="item.setNodeType == fistNodeIndex || item.setNodeStatus == 2"
            class="mesg"
            style="color: #00000073; margin: 5px 0px; font-size: 12px"
          >
            {{ configData.setNodeTypeDate[item.setNodeType] }}
          </div>
          <div
            v-if="item.setNodeStatus !== 1 && current >= index && item.errMsg"
            class="mesg"
            style="color: #ff4d4f; margin: 5px 0"
          >
            {{ item.errMsg }}
          </div>
        </div>
      </a-step>
    </a-steps>
    <div v-if="nodeList.length === 0">暂无数据</div>
    <a-modal v-model="winConfig.visible" :title="winConfig.title" :footer="null" :width="winConfig.width">
      <component :is="winConfig.component" :dataInfo="winConfig.dataInfo" :closeEvent="closeEvent"></component>
    </a-modal>
    <SigningPowerAttorney :show="show" :dataList="selectedRows" :event="spaEvent"></SigningPowerAttorney>
  </PCard>
</template>

<script>
import getDataForDB from '@/api/qsbBusinessManagement'
import * as Util from '@/utils/util.js'
import configData from './../util/configData'
import ImproveInformation from './ImproveInformation.vue'
import CollectionMethod from './CollectionMethod.vue'
import SigningPowerAttorney from './SigningPowerAttorney.vue'
import ChannelInformationAuthentication from './ChannelInformationAuthentication.vue'
import EntRegistInfo from './EntRegistInfo.vue'
import FirstTaxVerification from './FirstTaxVerification.vue'
import RegisterTaxBureau from './RegisterTaxBureau.vue'
import RegisterTaxBureau1 from './RegisterTaxBureau1.vue'
import { Icon } from 'ant-design-vue'
const MyIcon = Icon.createFromIconfontCN({
  scriptUrl: '//at.alicdn.com/t/c/font_3709892_q0uwo0tc0g.js', //'@/assets/fonts/iconfont.js', // 在 iconfont.cn 上生成  'https://at.alicdn.com/t/font_8d5l8fzk5b87iudi.js' //
})
export default {
  props: {
    title: '',
    nodeList: { type: Array, default: () => [] },
    config: {
      type: Object,
      default: () => {
        // 配置企业账户 setCorporateAccounts
        return { setCorporateAccounts: false, data: {} }
      },
    },
  },
  components: { ImproveInformation, CollectionMethod, SigningPowerAttorney,EntRegistInfo,FirstTaxVerification,RegisterTaxBureau,RegisterTaxBureau1, MyIcon, ChannelInformationAuthentication },
  data() {
    return {
      // 是否让当前流程是否继续
      continue:true,
      configData,
      fistNodeIndex: -1,
      // 签署渠道委托书
      show: false,
      selectedRows: [],
      // title:'开设进度',
      current: 0,
      //  0-无 1-显示补充企业信息 2-显示签署委托协议 3-显示提交审核按钮 4-显示首次办税登记按钮 5-显示实名认证截图按钮 6-显示选择纳税方式按钮 7-显示支付按钮 8-显示签署渠道委托书按钮 9-预约办理 10-修改预约时间 11-等待办理 => 已完成
      // 0-无 1-显示补充企业信息 2-显示签署委托协议 3-显示提交审核按钮 4-显示首次办税登记按钮 5-显示实名认证截图按钮 6-显示选择纳税方式按钮 7-显示支付按钮 8-显示签署渠道委托书按钮 9-预约办理 10-修改预约时间 11-等待办理
      // 操作方式 0-无 1-显示补充企业信息 2-显示上传纸质委托代征协议和邀请负责人线上签约按钮 3-显示提交审核按钮 4-显示首次办税登记按钮办理完成按钮 6-显示选择征收方式按钮 7-显示支付按钮 9-预约办理 10-修改预约时间 12-修改资料 13-修改企业名称
      // 14-显示查看注册信息按钮 15-重新办理-首次办税登记 16-重新办理-征收方式错误 17-重新办理-电子税务局未注册 18-重新办理-实名采集失败 19-开始办理-首次税务登记 20-开始办理-征收方式 21-开始办理-征收方式-首次税务登记已完成
      btnState: {
        1: ['补充企业信息'],
        2: ['邀请 负责人 线上 签约', '上传纸质委托代征协议'],
        3: ['提交审核'],
        4: ['首次办税登记'],
        5: ['实名认证截图'],
        6: ['选择纳税方式'],
        7: ['去支付'],
        8: ['签署'],
        9: ['预约注册时间'],
        10: ['修改预约时间'],
        11: ['已完成'],
        12: ['修改资料'],
        13: ['修改企业名称'],
        14: ['查看注册信息'],
        15:['重新办理'], // 重新办理-首次办税登记
        16:['重新办理'], // 重新办理-征收方式错误
        17:['重新办理'], // 重新办理-电子税务局未注册
        18:['重新办理'], // 重新办理-实名采集失败
        19:['开始办理'], // 开始办理-首次税务登记
        20:['征收方式'], // 开始办理-征收方式
        21:['征收方式'], // 开始办理-征收方式-首次税务登记已完成
        22:['注册电子税务局'], // 当处理完征收方式之后，未进行电子税务局未注册 之前的状态
        23:['重新办理'], // 当处理完征收方式之后，未进行电子税务局未注册 之前的状态
        24:['开始办理'], // 开始办理-征收方式-法人实名认证
        def: ['测试按钮'],
      },
      btnStateAuth: {
        1: ['ee_de:click:bcqyxi'],
        2: ['ee_de:click:yqfzrxsqy', 'ee_de:click:sczzwtdzxy'],
        3: ['ee_de:click:tjsh'],
        4: ['ee_de:click:scbsdj'],
        5: ['ee_de:click:smrzjt'],
        6: ['ee_de:click:xznsfs'],
        7: ['ee_de:click:qzf'],
        8: ['ee_de:click:qs'],
        9: ['ee_de:click:yyzcsj'],
        10: ['ee_de:click:xgzcsj'],
        11: ['ee_de:click:ywc'],
        12: ['ee_de:click:xgzl'],
        13: ['ee_de:click:xgqymc'],
        14: ['ee_de:click:ckzcxx'],
        15:['ee_de:click:cxblscbsdj'], // 重新办理-首次办税登记
        16:['ee_de:click:cxbldzfscw'], // 重新办理-征收方式错误
        17:['ee_de:click:cxbldzswjwzc'], // 重新办理-电子税务局未注册
        18:['ee_de:click:cxblsmcjsb'], // 重新办理-实名采集失败
        19:['ee_de:click:ksblscswdj'], // 开始办理-首次税务登记
        20:['ee_de:click:ksbldzfs'], // 开始办理-征收方式
        21:['ee_de:click:ksbldzfsscswdjywc'], // 开始办理-征收方式-首次税务登记已完成
        22:['ee_de:click:zcdzswj'], // 当处理完征收方式之后，未进行电子税务局未注册 之前的状态
        23:['ee_de:click:cxbldzswjwzcqzt'], // 当处理完征收方式之后，未进行电子税务局未注册 之前的状态
        24:['ee_de:click:ksbldzfsfrsmrz'], // 开始办理-征收方式-法人实名认证
      },
      btnStateStyle: {
        1: {},
        2: { 'margin-left': '-20px' },
        3: { 'padding-left': '15px' },
        4: {},
        5: {},
        6: {},
        7: { 'padding-left': '25px' },
        8: { 'padding-left': '25px' },
        9: { 'padding-left': '15px' },
        12: { 'padding-left': '15px' },
      },
      titleMarginStyle: {
        1: { 'margin-left': '13px' },
        2: { 'margin-left': '20px' },
        14: { 'margin-left': '22px' },
        6: { 'margin-left': '22px' },
        15: { 'margin-left': '22px' },
        8: { 'margin-left': '22px' },
        13: { 'margin-left': '22px' },
      },
      stateMarginStyle: {
        1: { 'margin-left': '13px' },
        2: { 'margin-left': '20px' },
        14: { 'margin-left': '22px' },
        6: { 'margin-left': '22px' },
        15: { 'margin-left': '22px' },
        7: { 'margin-left': '12px' },
        8: { 'margin-left': '22px' },
        9: { 'margin-left': '12px' },
        10: { 'margin-right': '21px' },
        13: { 'margin-left': '22px' },
      },
      winConfig: {
        visible: false,
        title: '完善信息',
        subTitle: '',
        width: 900,
        component: 'ImproveInformation',
        dataInfo: { tips: '', dataTips: '', data: {} },
      },
      // nodeList:[
      //   {setNodeName:'负责人信息', setNodeStatus:'1',setNodeType:'1'},
      //   {setNodeName:'企业信息', setNodeStatus:'2',setNodeType:'2'},
      //   {setNodeName:'负责人身份证', setNodeStatus:'3',setNodeType:'3'},
      //   {setNodeName:'登记注册认证', setNodeStatus:'2',setNodeType:'4'},
      //   {setNodeName:'签署委托协议', setNodeStatus:'0',setNodeType:'5'},
      //   {setNodeName:'材料审核', setNodeStatus:'0',setNodeType:'6'},
      // ]
    }
  },
  watch: {
    nodeList: {
      handler(val) {
        this.getCurrentNodeIndex()
      },
      deep: true,
      immediate: true,
    },
    config: {
      handler(val) {
        if (val && val.data) {
          this.getFirstNodet(val)
        }
      },
      deep: true,
      // immediate: true
    },
  },

  methods: {
    getFirstNodet(config) {
      const {
        data: { collectProgress = [], registProgress = [], taxProgress = [] },
      } = config
      const nodeList = [...collectProgress, ...registProgress, ...taxProgress]
      const tempArr = []
      nodeList &&
        nodeList.forEach((item, index) => {
          const { setNodeStatus, setNodeType } = item
          if (setNodeStatus == 2) {
            tempArr.push(index)
          } else {
            // if(setNodeStatus==0){
            //   tempArr.push(index)
            // }
          }
        })

      if (tempArr.length > 0) {
        const nodeIndex = Math.min(...tempArr)
        this.fistNodeIndex = nodeList[nodeIndex].setNodeType
      }
      // console.log('###################',nodeList,tempArr,this.fistNodeIndex,Math.min(...tempArr),tempArr.length>0);
    },
    spaEvent() {
      this.show = false
      this.$router.go(0)
    },
    btnEvent(type, ...args) {
      console.log('btnEvent', type, ...args)
    },
    getState(item) {
      const { setNodeStatus } = item
      return configData.setNodeStatu[setNodeStatus]
    },
    getHelp(item) {
      let res = null
      const { setNodeType } = item
      res = configData.nodeHelp[setNodeType] || null
      return res
    },
    helpEvent(item) {
      const { setNodeType } = item
      // const ll = {
      //   4: 0, // 登记注册认证
      //   10: 0, // 首次办税登记
      //   11: 1 // 实名认证截图
      // }
      // console.log('帮助信息操作', item);
      // this.$router.push({
      //   path: '/enterprise/taxRealname',
      //   query: {
      //     bizId: ll[setNodeType]
      //   }
      // });

      //       /enterprise/taxRegistration    首次办税登记
      // /enterprise/taxRealname?bizId=0  登记注册认证
      // /enterprise/taxRealname?bizId=1  实名认证截图

      const ll_ = {
        4: () => {
          // 登记注册认证
          return {
            path: '/enterprise/taxRealname',
            query: {
              bizId: 0,
            },
          }
        },
        10: () => {
          // 首次办税登记
          return {
            path: '/enterprise/taxRegistration',
          }
        },
        11: () => {
          // 实名认证截图
          return {
            path: '/enterprise/taxRealname',
            query: {
              bizId: 1,
            },
          }
        },
      }

      this.$router.push({ ...ll_[setNodeType]() })
    },
    ciaEvent(title) {
      this.winConfig.title = title
    },
    // 进行中的事件
    haveInEvent(item, btnItem) {
      console.log('haveInEvent  ====>',item, btnItem);
      const { channelIdEncrept, entId, ticket, agreeId, legalName, cardNumber, taxId, realNameCodeStatus } = this.config.data
      let agreeId_ = agreeId
      // errMsg:null
      // opDis:0
      // setNodeName:"负责人信息"
      // setNodeStatus:1
      // setNodeType:1

      const goto = (no) => {
        this.$router.push({
          path: '/enterprise/establishEnterprise',
          query: {
            registerType: 1,
            bizId: entId,
            nodeType: no,
          },
        })
      }
      const pagetabList = {
        1: 0,
        2: 1,
        4: 2,
        5: 2,
        6: 0, // h5 页面 补充材料
      }
      const { setNodeType, opDis } = item


      // 1-负责人信息 2-企业信息 3-负责人身份证 4-登记注册认证 5-签署委托协议 14-提交审核 6-材料审核 16-签署渠道委托书 15-支付订单 7-进入工商注册 8-企业核名完成 9-工商注册完成 10-首次办税登记 11-实名认证截图 12-选择纳税方式 13-票种登记

      // 节点类型 1-负责人信息 2-企业信息 3-负责人身份证 4-登记注册认证 5-签署委托协议 14-提交审核 6-材料审核 16-签署渠道委托书 15-支付订单 7-进入工商注册 8-企业核名完成 9-工商注册完成 10-首次办税验证 17-基础信息登记 11-注册电子税务局 12-选择征收方式 13-登记完成
      const setNodeType2Action = {
        1: (btnItem) => {
          goto(4)
        },
        2: (btnItem) => {
          goto(4)
        },
        3: (btnItem) => {
          goto(4)
        }, // x
        4: (btnItem) => {
          goto(4)
        },
        5: async (btnItem) => {


          if (btnItem == '邀请 负责人 线上 签约') {
            const param = {
              entId: this.config.data.entId,
            }
            const res = await getDataForDB('邀请负责人线上签署', param)
            if (res.code != 200) {
              this.$message.warning(res.message)
              return false
            }
            agreeId_ = res.result.agreeId
            const url = `${process.env.VUE_APP_WEB_BASE_URL}#/user/settledEnterprise?ticket=${ticket}&agreeId=${agreeId_}&channelIdEncrept=${channelIdEncrept}&pagetab=${pagetabList[setNodeType]}`
            if (res.result.status == 1) {
              this.$confirm({
                title: '提示',
                content: '请复制链接，发送给用户或相关人员完成电子签署委托协议',
                okText: '复制链接',
                cancelText: '取消',
                onOk: () => {
                  return new Promise((resolve, reject) => {
                    Util.copyLinkContent(url, this)
                    resolve()
                  })
                },
                onCancel() {},
              })
            } else {
              this.winConfig.width = 700
              this.winConfig.dataInfo = {
                pageType: 0,
                btnType: '1', // 1  立即认证  2 立即认证
                btnLabel: '立即认证',
                entId:this.config.data.entId,
                cardStatus: res.result.cardStatus,
                phoneStatus: res.result.phoneStatus,
                event: this.ciaEvent,
              }
              this.winConfig.visible = true
              this.winConfig.title = '邀请负责人线上签约'
              this.winConfig.component = 'ChannelInformationAuthentication'
            }
          }
          if (btnItem == '上传纸质委托代征协议') {
            // goto(5)
            this.winConfig.dataInfo = {
              pageType: 1,
              btnType: '1', // 1  立即认证  2 立即认证
              btnLabel: '立即认证',
              entId:this.config.data.entId,
              event: this.ciaEvent,
            }
            this.winConfig.width = 600
            this.winConfig.title = '上传纸质委托代征协议'
            this.winConfig.visible = true
            this.winConfig.component = 'ChannelInformationAuthentication'
          }
        }, // 签署委托协议 进行强制电子签
        14: (btnItem) => {
          goto(6)
        },
        // 6: '材料审核',
        6: (btnItem) => {
          goto(7)
        },
        15: (btnItem) => {
          const key = 'timelineCard'
          Util.Storage.set(key, { orderNo: [this.config.registOrderNo] })
          this.$router.push({
            path: '/myAccount/accountManage',
            query: {
              po: key,
            },
          })
        },
        7: (btnItem) => {
          opDis == 1 && goto(1)
        }, //'进入工商注册',
        8: (btnItem) => {
          goto(8)
        }, //'企业核名完成',
        9: (btnItem) => {
          // opDis == 1 && goto(1)
          console.log('工商注册完成',btnItem,item);
          // 新版
          this.actionGroupEvent(item)
        }, //'工商注册完成',
        10: (btnItem) => {
          // opDis
          //   15:['重新办理'], // 重新办理-首次办税登记
          //   19:['开始办理'], // 开始办理-首次税务登记
          const getOpDisAction = {
            15: ()=>{
              this.continue = false
              return {setNodeType:'10'}
            },
            19: ()=>{
              return {setNodeType:'10'}
            },
          }
          this.continue = true
          const tempopDis = item.opDis
          getOpDisAction[tempopDis] && this.actionGroupEvent(getOpDisAction[tempopDis]())
        },
        // 注册电子税务局
        11: (btnItem) => {
          // this.actionGroupEvent(item)
          this.$router.push({
            path: '/appointmentProcessing/appointmentProcessAdd',
            query: {
              bizId: taxId,
              masterId: entId,
              realNameCodeStatus: opDis,
            },
          })
        },
        // 选择纳税方式
        12: (btnItem) => {
          // opDis
            // 16:['重新办理'], // 重新办理-征收方式错误                {setNodeType:'120'}
            // 17:['重新办理'], // 重新办理-电子税务局未注册             {setNodeType:'10-1'}
            // 18:['重新办理'], // 重新办理-实名采集失败                 {setNodeType:'10-3'}
            // 20:['征收方式'], // 开始办理-征收方式                    {setNodeType:'12'}
            // 21:['征收方式'], // 开始办理-征收方式-首次税务登记已完成  {setNodeType:'120'}
            // 22:['注册电子税务局'] // 电子税务局未注册             {setNodeType:'10-1'}
            // 23:['重新办理'] // 首次办税验证失败，征收方式全失败 时 {setNodeType:'10-1'}
            // 24:['重新办理'] // 开始办理-征收方式-法人实名认证 时 {setNodeType:'10-3'}
            const getOpDisAction = {
              16: ()=>{
                this.continue = false
                return {setNodeType:'120'}
              },
              17: ()=>{
                this.continue = false
                return {setNodeType:'10-1'}
              },
              18: ()=>{
                this.continue = false
                return {setNodeType:'10-3'}
              },
              20: ()=>{
                return {setNodeType:'12'}
              },
              21: ()=>{
                return {setNodeType:'120'}
              },
              22: ()=>{
                return {setNodeType:'10-1'}
              },
              23: ()=>{
                return {setNodeType:'10-4'}
              },
              24: ()=>{
                this.continue = false
                return {setNodeType:'10-3'}
              },
            }
            this.continue = true
            const tempopDis = item.opDis
            getOpDisAction[tempopDis] && this.actionGroupEvent(getOpDisAction[tempopDis]())
        },
        // 16-签署渠道委托书
        16: (btnItem) => {
          const selectedRows_ = []
          selectedRows_.push({
            cardNumber: cardNumber,
            id: entId, // entId
            legalName: legalName,
          })
          this.selectedRows = selectedRows_
          this.show = true
        },
        // 实名验证码   基础信息登记
        // 17: (btnItem) => {
        //   this.$router.push({
        //     path: '/appointmentProcessing/appointmentProcessAdd',
        //     query: {
        //       bizId: taxId,
        //       masterId: entId,
        //       realNameCodeStatus:opDis
        //     }
        //   });
        // },
        13: (btnItem) => {
          this.config.timeLineEvent('gameOver',true)
        },
      }

      setNodeType2Action[setNodeType] && setNodeType2Action[setNodeType](btnItem)
    },
    //点击补充
    getAction(type, item) {
      const { channelIdEncrept, entId, ticket, agreeId } = this.config.data
      const { errMsg, setNodeName, setNodeStatus, setNodeType } = item
      // setNodeType
      // pagetab 0法人  1企业  2上传协议  2合同签署
      const pagetabList = {
        1: 0,
        2: 1,
        4: 2,
        5: 2,
        6: 0, // h5 页面 补充材料
      }

      const url = `${process.env.VUE_APP_WEB_BASE_URL}#/user/settledEnterprise?ticket=${ticket}&agreeId=${agreeId}&channelIdEncrept=${channelIdEncrept}&pagetab=${pagetabList[setNodeType]}`
      if (type === '1') {
        // 拷贝链接
        this.$confirm({
          title: '提示',
          content: '请复制链接，发送给用户完成填写',
          okText: '复制链接',
          cancelText: '取消',
          onOk: () => {
            return new Promise((resolve, reject) => {
              Util.copyLinkContent(url, this)
              resolve()
            })
          },
          onCancel() {},
        })
      }
      if (type === '2') {
        // 跳转链接  enterprise/establishEnterprise?registerType=1&bizId=企业id
        this.$router.push({
          path: '/enterprise/establishEnterprise',
          query: {
            registerType: 1,
            bizId: entId,
          },
        })
      }
      // console.log(type, item, this.config);
    },
    getUserNodeInfo(item) {
      let res = null
      const { setNodeType } = item
      res = configData.userNode[setNodeType]
      // console.log('$$$$$$$$$$$$$$$$$$$$',res,setNodeType,configData.userNode);
      return res
    },
    getNodeStatuInfoIconAttr(item, index) {
      let res = null
      const { setNodeStatus, setNodeType } = item
      let setNodeStatus_ = setNodeStatus
      if (this.fistNodeIndex == setNodeType) {
        setNodeStatus_ = 2
      }
      res = configData.setNodeStatuInfo[setNodeStatus_].icon
      // console.log('@@@@@@@@@@@@@@@@',item,index,res,setNodeStatus_,setNodeStatus,setNodeType,this.fistNodeIndex,this.fistNodeIndex == setNodeType);
      return res
    },
    // 获取节点的数据状态
    getNodeStatuInfo(item, index) {
      let res = null
      const { setNodeStatus, setNodeType } = item
      let setNodeStatus_ = setNodeStatus
      if (this.fistNodeIndex == setNodeType) {
        setNodeStatus_ = 2
      }
      res = configData.setNodeStatuInfo[setNodeStatus_].stepStatus
      return res
    },
    getCurrentNodeIndex() {
      let tempIndex = 0
      this.nodeList.forEach((item, index) => {
        const { setNodeStatus } = item
        if (setNodeStatus == 2 || setNodeStatus == 3) {
          tempIndex = index
        }
      })
      this.current = tempIndex
    },
    closeEvent(type,data) {
      this.winConfig.visible = false
      this.winConfig.title = ''
      this.winConfig.component = ''
      this.winConfig.dataInfo.tips = ''
      this.winConfig.dataInfo.dataTips = ''
      const typeAction = {
        'Refresh':()=>{
          // 需要刷新页面 timeLineEvent
          this.config.timeLineEvent && this.config.timeLineEvent('Refresh')
        },
        'completed':()=>{
           // 已完成
          this.actionGroupEvent({ setNodeType: 120 })
        },
        'incomplete':()=>{
          // 未完成
          this.actionGroupEvent({ setNodeType: 130 })
        },
        'howAuthenticate':()=>{
           // 查看如何认证  helpEvent 查看法人实名采集方法
          this.helpEvent({ setNodeType: 11 })
        },
        'GoBackStep':()=>{
          // 首次办税验证
          this.actionGroupEvent({ setNodeType: 10 })
        },
        'ContinueNextStep':()=>{
          // 继续办理
          this.actionGroupEvent({ setNodeType: 120 })
        },
        'RegisterTaxBureau':()=>{
          this.config.timeLineEvent('Refresh')
          // 注册电子税务局
          this.actionGroupEvent({ setNodeType: '10-1' })
        },
        'RegisterTaxBureau1':()=>{
          // 注册电子税务局
          this.actionGroupEvent({ setNodeType: '10-2' })
        },
        'ContinueNextStep1':()=>{
          // 继续办理
          this.actionGroupEvent({ setNodeType: '120' })
        },
        'RealNameCollectionLegalEntityCompleted':()=>{
          // 请确认您是否已经完成了法人实名采集？
          // 已完成实名采集需要调用接口
          // this.actionGroupEvent({ setNodeType: '10-2' })
          getDataForDB('修改法人实名采集已完成',{ id:this.config.data.taxId}).then(res=>{
            if(res.success==true){
              this.$message.success('提交成功')
              this.config.timeLineEvent('Refresh')
            }else{
              this.$message.warning(res.message || '接口调用失败')
            }
          })
        },
      }
      typeAction[type] && typeAction[type]()

    },
    actionGroupEvent(item) {
      const { setNodeType } = item

      this.winConfig.width = 900
      const setNodeTypeActionList = {
        '9':()=>{
          // 新版
          this.winConfig.width = 1200
          this.winConfig.dataInfo = {
            entId: this.config.data.entId,
          }
          this.winConfig.visible = true
          this.winConfig.title = '工商注册信息'
          this.winConfig.component = 'EntRegistInfo'
        },
        '10':()=>{
           // this.winConfig.title = '操作提示' // 完善信息
          // this.winConfig.component = 'ImproveInformation'
          // // this.winConfig.dataInfo.tips = '请务必完成首次办税登记后点击，若未完成会导致办理时间延长。'
          // // this.winConfig.dataInfo.dataTips = '请上传首次办税登记截图'
          // this.winConfig.dataInfo.status = 'warning'
          // this.winConfig.dataInfo.resTitle = '为保证您的业务能够顺利办理，请再次确认您是否已经完成本项验证！'
          // this.winConfig.dataInfo.cancelLabel = '取消'
          // this.winConfig.dataInfo.confirmLabel = '确认'
          // this.winConfig.dataInfo.cancelType = ''
          // this.winConfig.dataInfo.confirmType = 'primary'
          // this.winConfig.dataInfo.cancelAttr = { size: 'large', shape: 'round', block: true, icon: 'close-circle' }
          // this.winConfig.dataInfo.confirAttr = { size: 'large', shape: 'round', block: true, icon: 'check-circle' }
          // // cancelType,confirmType, cancelAttr,confirAttr
          // 新版
          this.winConfig.width = 800
          this.winConfig.dataInfo = {
            entId: this.config.data.entId,
            continue:this.continue,
            taxId: this.config.data.taxId,
            helpEvent:this.helpEvent
          }
          this.winConfig.visible = true
          this.winConfig.title = '首次办税验证'
          this.winConfig.component = 'FirstTaxVerification'
        },
        // 注册电子税务局
        '10-1':()=>{
           // this.winConfig.title = '操作提示' // 完善信息
          // this.winConfig.component = 'ImproveInformation'
          // // this.winConfig.dataInfo.tips = '请务必完成首次办税登记后点击，若未完成会导致办理时间延长。'
          // // this.winConfig.dataInfo.dataTips = '请上传首次办税登记截图'
          // this.winConfig.dataInfo.status = 'warning'
          // this.winConfig.dataInfo.resTitle = '为保证您的业务能够顺利办理，请再次确认您是否已经完成本项验证！'
          // this.winConfig.dataInfo.cancelLabel = '取消'
          // this.winConfig.dataInfo.confirmLabel = '确认'
          // this.winConfig.dataInfo.cancelType = ''
          // this.winConfig.dataInfo.confirmType = 'primary'
          // this.winConfig.dataInfo.cancelAttr = { size: 'large', shape: 'round', block: true, icon: 'close-circle' }
          // this.winConfig.dataInfo.confirAttr = { size: 'large', shape: 'round', block: true, icon: 'check-circle' }
          // // cancelType,confirmType, cancelAttr,confirAttr
          // 新版
          this.winConfig.width = 800
          this.winConfig.dataInfo = {
            entId: this.config.data.entId,
            continue:this.continue,
            helpEvent:this.helpEvent
          }
          this.winConfig.visible = true
          this.winConfig.title = '确认征收方式——注册电子税务局'
          this.winConfig.component = 'RegisterTaxBureau'
        },
        // 注册电子税务局
        '10-2':()=>{
          // 新版
          this.winConfig.width = 800
          this.winConfig.dataInfo = {
            entId: this.config.data.entId,
            helpEvent:this.helpEvent,
            continue:this.continue,
            taxId:this.config.data.taxId

          }
          this.winConfig.visible = true
          this.winConfig.title = '确认征收方式——注册电子税务局'
          this.winConfig.component = 'RegisterTaxBureau1'
        },
        '10-3':()=>{
          // 新版
          this.winConfig.dataInfo.status = 'warning'
          this.winConfig.dataInfo.resTitle = '请确认您是否已经完成了法人实名采集？'
          this.winConfig.dataInfo.cancelLabel = '已完成'
          this.winConfig.dataInfo.confirmLabel = '查看采集方法'
          this.winConfig.dataInfo.cancelEventName = 'RealNameCollectionLegalEntityCompleted'
          this.winConfig.dataInfo.confirmEventName = 'howAuthenticate'
          this.winConfig.dataInfo.cancelType = 'primary'
          this.winConfig.dataInfo.confirmType = 'primary11'
          this.winConfig.dataInfo.cancelAttr = { size: 'large', shape: 'round', block: true, icon: 'check' }
          this.winConfig.dataInfo.confirAttr = { size: 'large', shape: 'round', block: true, icon: 'eye' }
          this.winConfig.title = '选择纳税方式'
          this.winConfig.component = 'ImproveInformation'
        },
        '10-4':()=>{
          // 新版
          this.winConfig.dataInfo.status = 'warning'
          this.winConfig.dataInfo.resTitle = '您尚未完成首次办税验证，基础信息无法登记，可能会导致业务办理失败！建议您先完成首次办税验证。'
          this.winConfig.dataInfo.cancelLabel = '首次办税验证'
          this.winConfig.dataInfo.confirmLabel = '继续办理'
          this.winConfig.dataInfo.cancelEventName = 'GoBackStep'
          this.winConfig.dataInfo.confirmEventName = 'ContinueNextStep1'
          this.winConfig.dataInfo.cancelType = 'primary'
          this.winConfig.dataInfo.confirmType = 'primary11'
          this.winConfig.dataInfo.cancelAttr = { size: 'large', shape: 'round', block: true, icon: 'rollback' }
          this.winConfig.dataInfo.confirAttr = { size: 'large', shape: 'round', block: true, icon: 'check' }
          this.winConfig.title = '首次办税验证确认'
          this.winConfig.component = 'ImproveInformation'
        },
        '12':()=>{
          // this.winConfig.dataInfo.status = 'warning'
          // this.winConfig.dataInfo.resTitle = '请确认您是否已经完成了法人实名采集？'
          // this.winConfig.dataInfo.cancelLabel = '已完成'
          // this.winConfig.dataInfo.confirmLabel = '未完成'
          // this.winConfig.dataInfo.cancelEventName = 'completed'
          // this.winConfig.dataInfo.confirmEventName = 'incomplete'
          // this.winConfig.dataInfo.cancelType = 'primary'
          // this.winConfig.dataInfo.confirmType = ''
          // this.winConfig.dataInfo.cancelAttr = { size: 'large', shape: 'round', block: true, icon: 'check' }
          // this.winConfig.dataInfo.confirAttr = { size: 'large', shape: 'round', block: true, icon: 'close' }
          // this.winConfig.title = '实名认证确认'
          // this.winConfig.component = 'ImproveInformation'
          //新版
          this.winConfig.dataInfo.status = 'warning'
          this.winConfig.dataInfo.resTitle = '您尚未完成首次办税验证，基础信息无法登记，可能会导致业务办理失败！建议您先完成首次办税验证。'
          this.winConfig.dataInfo.cancelLabel = '首次办税验证'
          this.winConfig.dataInfo.confirmLabel = '继续办理'
          this.winConfig.dataInfo.cancelEventName = 'GoBackStep'
          this.winConfig.dataInfo.confirmEventName = 'ContinueNextStep'
          this.winConfig.dataInfo.cancelType = 'primary'
          this.winConfig.dataInfo.confirmType = ''
          this.winConfig.dataInfo.cancelAttr = { size: 'large', shape: 'round', block: true, icon: 'rollback' }
          this.winConfig.dataInfo.confirAttr = { size: 'large', shape: 'round', block: true, icon: 'check' }
          this.winConfig.title = '首次办税验证确认'
          this.winConfig.component = 'ImproveInformation'
        },
        '130':()=>{
          this.winConfig.dataInfo.status = 'info'
          this.winConfig.dataInfo.resTitle =
            '未完成法人实名采集将导致您无法进行票种核定，请在完成法人实名采集后，再进行征收方式的选择，谢谢您的配合！'
          this.winConfig.dataInfo.cancelLabel = '我知道了'
          this.winConfig.dataInfo.confirmLabel = '查看如何认证'
          this.winConfig.dataInfo.cancelEventName = 'Refresh'
          this.winConfig.dataInfo.confirmEventName = 'howAuthenticate'

          this.winConfig.dataInfo.cancelType = ''
          this.winConfig.dataInfo.confirmType = 'primary'
          this.winConfig.dataInfo.cancelAttr = { size: 'large', shape: 'round', block: true, icon: 'check-square' }
          this.winConfig.dataInfo.confirAttr = { size: 'large', shape: 'round', block: true, icon: 'play-circle' }

          this.winConfig.title = '实名认证提示'
          this.winConfig.component = 'ImproveInformation'
        },
        '120': async ()=>{

          const res = await getDataForDB('查询企业合同服务模式配置', {entId:this.config.data.entId })
          if(res.success==true){
            if(!this.isType.isNullOrUnDef(res.result.serviceModelAry) && !this.isType.isEmpty(res.result.serviceModelAry)){
              this.winConfig.dataInfo.data.serviceModelAry = res.result.serviceModelAry
            }
          }
          this.winConfig.component = 'CollectionMethod'
          // this.winConfig.dataInfo.closeEventType = 'Refresh'
          this.winConfig.dataInfo.closeEventType = 'RegisterTaxBureau'
          this.winConfig.dataInfo.tipsConfig = {
            tips:'如对征收方式有疑问的可以与客服进行沟通确认！',
            type:'warning'
          }
          // this.winConfig.subTitle = ''
          this.winConfig.title = '选择征收方式'
        },
      }
      this.winConfig.dataInfo.data = { ...item,continue:this.continue, taxId: this.config.data.taxId || '',entId:this.config.data.entId ,serviceModelAry:[]}
      setNodeTypeActionList[setNodeType]&&setNodeTypeActionList[setNodeType]()
      this.winConfig.visible = true
    },
    /**
     * 配置企业账户
     */
    pzqyzhEvent() {
      // console.log('需要文乐提供地址');
      this.$router.push({
        path: '/myAccount/entAccountManagementAdd',
        query: {
          bizId: this.config.data.entId,
          masterType:'2'
        },
      })
    },
  },
}
</script>

<style lang="less">
.card-title {
  .title {
    font-size: 18px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #333333;
    // display: flex;
  }

  .description {
    .mesg {
      color: red;
    }
    .info {
      color: rgba(0, 0, 0, 0.45);
    }
  }
}

.dddd {
  display: flex;
  justify-content: center;
  align-items: center;
}

.steps-con {
  .ant-steps-item {
    .ant-steps-item-container {
      .ant-steps-item-content {
        width: 100%;
        text-align: left;

        .ant-steps-item-title {
          text-align: center;
          // width: 140px;
        }
      }
    }
  }
}

.tooltip-con {
  .ant-tooltip-content {
    .ant-tooltip-arrow::before {
      background-color: aquamarine;
    }

    .ant-tooltip-inner {
      background-color: aliceblue;
      color: #333333;
    }
  }
}

.ant-tooltip-content {
  .ant-tooltip-arrow::before {
    background-color: aquamarine;
  }

  .ant-tooltip-inner {
    background-color: aliceblue;
    color: #333333;
  }
}

.btn-action-group {
  width: 100%;
  // height: 50px;
  padding: 10px 10px;
}

.ant-modal-title {
  text-align: left;
}

.ant-btn-primary11 {
    color: #1890ff;
    background-color: #fff;
    border-color: #1890ff;
    text-shadow: 0 -1px 0 rgba(0,0,0,.12);
    box-shadow: 0 2px 0 rgba(0,0,0,.045);
}
</style>
